import { ShortcutsItem } from "../../../view/shortcuts/ShortcutsItem";
import { SkillInfo } from "../../../model/SkillInfo";
import { SkillUseLaterUtil } from "../../../scene/skill/useLater/SkillUseLaterUtil";
import { MsgManager } from "../../../manager/MsgManager";
import { Language } from "../../../../../extend/language/Language";
import { ESkillUseType } from "../../../../../Message/Public/ESkillUseType";
import { Dispatcher } from "../../../../mvc/core/Dispatcher";
import { DataEvent } from "../../../events/DataEvent";
import { EventName } from "../../../mvc/EventName";
import { ObjCreate } from "../../../view/common/ObjCreate";
import { GTextFiled } from "../../../../../com/mui/controls/GTextFiled";
type int = number;
//class SpecialShortcutsItem
    
    export  class SpecialShortcutsItem extends ShortcutsItem
    {
        constructor(arg1: int=0)
        {
            super(arg1);
            this.addEventListener(flash.events.MouseEvent.CLICK, this.onClick);
            return;
        }

        protected onClick(arg1: Object /* flash.events.MouseEvent */): void
        {
            this.doAction();
            return;
        }

        public doAction(): void
        {
            var loc1=null;
            if (this.playingEffect) 
            {
                if (typeof this.dragSource === "skillinfo") 
                {
                    SkillUseLaterUtil.addSkillUseLater(this.dragSource as SkillInfo);
                    MsgManager.showRollTipsMsg(Language.getString(51078));
                }
                return;
            }
            if (this.dragSource) 
            {
                if (typeof this.dragSource === "skillinfo") 
                {
                    loc1 = this.dragSource as SkillInfo;
                    if (loc1.useType == ESkillUseType._ESkillUseTypeInitiative) 
                    {
                        Dispatcher.dispatchEvent(new DataEvent(EventName.SkillUseSkill, loc1));
                    }
                }
            }
            return;
        }

        public /* override */ set dragSource(arg1: Object)
        {
            super.dragSource = arg1;
            var loc1=arg1 as SkillInfo;
            if (!(loc1 == null) && !(loc1.useType == ESkillUseType._ESkillUseTypeInitiative)) 
            {
                if (this._txtBeiDong == null) 
                {
                    this._txtBeiDong = ObjCreate.createGTextField("", 2, 20, 20, 20, this, null, false);
                    this._txtBeiDong.htmlText = Language.getString(80337);
                }
                this._txtBeiDong.visible = true;
            }
            else if (this._txtBeiDong != null) 
            {
                this._txtBeiDong.visible = false;
            }
            return;
        }

        private /* var */_txtBeiDong: GTextFiled;
    }
